# -*- coding: utf-8 -*-

from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from app.config.configs import configs

app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = "mysql+pymysql://"+configs['sqlalchemy']['db_user']+":"+configs['sqlalchemy']['db_pwd']+"@"+configs['sqlalchemy']['db_host']+":"+configs['sqlalchemy']['db_port']+"/"+configs['sqlalchemy']['db_name']
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
# app.config['SQLALCHEMY_ECHO'] = True
# app.config['JSON_AS_ASCII'] = False
app.config['SECRET_KEY'] = configs['secret_key']
app.debug = True
db = SQLAlchemy(app)

from app.module.www import www as www_blueprint
from app.module.admin import admin as admin_blueprint

app.register_blueprint(www_blueprint)
app.register_blueprint(admin_blueprint, url_prefix="/admin")
